package com.lc.pda.util;

import java.util.Objects;

/**
 * @program: wms_pda
 * @description: 状态枚举
 * @author: Tycoon.Wang
 * @create: 2023-07-23 15:54
 **/
public interface Enums {

    enum ReceiptStatusEnum {
        init("0", "新建"),
        ing("10", "进行中"),
        finish("20", "已完成"),
        cancel("99", "撤销");
        private final String status;
        private final String name;

        ReceiptStatusEnum(String status, String name) {
            this.status = status;
            this.name = name;
        }

        public String getStatus() {
            return this.status;
        }

        public String getName() {
            return this.name;
        }

        public static ReceiptStatusEnum getEnumByStatus(String status) {
            for (ReceiptStatusEnum value : ReceiptStatusEnum.values()) {
                if (Objects.equals(value.getStatus(), status)) {
                    return value;
                }
            }
            throw new IllegalArgumentException();
        }
    }


    enum ReceiptTypeEnum {
        raw_receipt("1", "原料入库"),
        pro_receipt("2", "成品入库"),
        raw_return("3", "原料回库");
        private final String type;
        private final String name;

        ReceiptTypeEnum(String type, String name) {
            this.type = type;
            this.name = name;
        }

        public String getType() {
            return this.type;
        }

        public String getName() {
            return this.name;
        }

        public static ReceiptTypeEnum getEnumByType(String type) {
            for (ReceiptTypeEnum value : ReceiptTypeEnum.values()) {
                if (Objects.equals(value.getType(), type)) {
                    return value;
                }
            }
            throw new IllegalArgumentException();
        }
    }


    enum StoreTypeEnum {

        product("0", "良品"),

        non_product("1", "不良品"),

        scrap("2", "报废品");

        private final String type;
        private final String name;

        StoreTypeEnum(String type, String name) {
            this.type = type;
            this.name = name;
        }

        public String getType() {
            return this.type;
        }

        public String getName() {
            return this.name;
        }

        public static StoreTypeEnum getEnumByType(String type) {
            for (StoreTypeEnum value : StoreTypeEnum.values()) {
                if (Objects.equals(value.getType(), type)) {
                    return value;
                }
            }
            throw new IllegalArgumentException();
        }
    }

    enum TaskTypeEnum {

        in("in", "入库"),

        out("out", "出库");

        private final String type;
        private final String name;

        TaskTypeEnum(String type, String name) {
            this.type = type;
            this.name = name;
        }

        public String getType() {
            return this.type;
        }

        public String getName() {
            return this.name;
        }

        public static TaskTypeEnum getEnumByType(String type) {
            for (TaskTypeEnum value : TaskTypeEnum.values()) {
                if (Objects.equals(value.getType(), type)) {
                    return value;
                }
            }
            throw new IllegalArgumentException();
        }
    }

    enum TaskStatusEnum {
        init("0", "新建"),
        ing("10", "执行中"),
        finish("30", "已完成"),
        cancel("40", "作废");
        private final String status;
        private final String name;

        TaskStatusEnum(String status, String name) {
            this.status = status;
            this.name = name;
        }

        public String getStatus() {
            return this.status;
        }

        public String getName() {
            return this.name;
        }

        public static TaskStatusEnum getEnumByStatus(String status) {
            for (TaskStatusEnum value : TaskStatusEnum.values()) {
                if (Objects.equals(value.getStatus(), status)) {
                    return value;
                }
            }
            throw new IllegalArgumentException();
        }
    }

}
